import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login'
import Details from '../views/common/Details'
import AdminIndex from '../views/admin/Index'
import StudentIndex from '../views/student/Index'
import UpdateDetails from '../views/common/UpdateDetails'
import UpdatePassword from '../views/common/UpdatePassword'
import updateStepOne from '../views/common/updateStepOne'
import updateStepTwo from '../views/common/updateStepTwo'
import updateStepThree from '../views/common/updateStepThree'

import Class from '../views/admin/Class'
import Student from '../views/admin/Student'
import Resource from '../views/admin/Resource'
import CourseDetails from '../views/admin/course/CourseDetails'
import StudentCourseDetails from '../views/student/course/CourseDetails'
import StudentWork from '../views/student/course/StudentWork'
import StudentResource from '../views/student/course/StudentResource'
import StudentNotice from '../views/student/course/StudentNotice'
import CourseClass from '../views/admin/course/class/CourseClass'
import CourseEdit from '../views/admin/course/CourseEdit'
import CourseResource from '../views/admin/course/resource/CourseResource'
import CourseWorkDetails from '../views/admin/course/work/CourseWorkDetails'
import NoticeDetails from '../views/admin/course/notice/NoticeDetails'
import CourseNotice from '../views/admin/course/notice/CourseNotice'
import WorkLibrary from '../views/admin/course/work/WorkLibrary'
import MarkingWork from '../views/admin/course/work/MarkingWork'

Vue.use(VueRouter)

const routes = [
  {
    path: '/', // 默认进入路由
    redirect: '/login' //重定向
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/details',
    name: 'Details',
    component: Details,
  },
  {
    path: '/admin/index',
    name: 'adminIndex',
    component: AdminIndex,
  },
  {
    path: '/class',
    name: 'class',
    component: Class,
  },
  {
    path: '/resource',
    name: 'resource',
    component: Resource
  },
  {
    path: '/student',
    name: 'student',
    component: Student,
  },
  {
    path: '/student/course',
    name: 'studentCourse',
    component: StudentCourseDetails,
    children: [
      {
        path: 'work',
        name: 'studentWork',
        component: StudentWork,
      },
      {
        path: 'resource',
        name: 'studentResource',
        component: StudentResource,
      },
      {
        path: 'notice',
        name: 'studentNotice',
        component: StudentNotice,
      },
    ]
  },

  {
    path: '/course',
    name: 'course',
    component: CourseDetails,
    redirect: '/course/class',
    children: [
      {
        path: 'class',
        name: 'class',
        component: CourseClass,
      },
      {
        path: 'edit',
        name: 'edit',
        component: CourseEdit,
      },
      {
        path: 'resource',
        name: 'resource',
        component: CourseResource,
      },
      {
        path: 'work',
        name: 'work',
        component: CourseWorkDetails,
      },
      {
        path: 'notice',
        name: 'notice',
        component: CourseNotice,
      },
      {
        path: 'noticeDetails',
        name: 'noticeDetails',
        component: NoticeDetails,
      },
      {
        path: 'library',
        name: 'library',
        component: WorkLibrary,
      },
      {
        path: 'markingWork',
        name: 'markingWork',
        component: MarkingWork,
      },
    ]
  },
  {
    path: '/student/index',
    name: 'studentIndex',
    component: StudentIndex,
  },
  {
    path: '/updateDetails',
    name: 'updateDetails',
    component: UpdateDetails,
  }, {
    path: '/updatePassword',
    name: 'UpdatePassword',
    component: UpdatePassword,
    redirect: '/updatePassword/updateStepOne',
    children: [
      {
        path: 'updateStepOne',
        name: 'updateStepOne',
        component: updateStepOne,
      },
      {
        path: 'updateStepTwo',
        name: 'updateStepTwo',
        component: updateStepTwo,
      },
      {
        path: 'updateStepThree',
        name: 'updateStepThree',
        component: updateStepThree,
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
